{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fswiss\fcharset0 Arial;}{\f1\fnil Courier New;}{\f2\fnil\fcharset0 Courier New;}}
{\colortbl ;\red63\green127\blue95;\red0\green0\blue0;\red42\green0\blue255;\red100\green100\blue100;\red127\green0\blue85;\red0\green0\blue255;\red0\green0\blue192;\red63\green95\blue191;\red127\green159\blue191;}
{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\lang1046\b\f0\fs20 Author: Jairo de Almeida\par
Version: 1.0\par
Date: 24/04/2011\b0\par
\par
\b\fs24 User guide of easy-gpa library\fs20\par
\par
How to use? \b0\par
First of all, set the \b easy-gpa.jar,\b0 the liked database\b  jdbc\b0 , and the \b log4j-1.2.14.jar\b0  library in your \b classpath \b0 and configurate the database instance in your project, in \b source folder \b0 in your project you will create a \b database-config.properties \b0 file\par
and setting the configuration to database instance.\par
\par
\b example to postgresql database\par
\cf1\b0\f1 ## define a type of database connection\cf0\par
\cf2 database.type = \cf3\ul postgres\cf0\ulnone\par
\par
\cf1 ## \ul postgresql\ulnone  connection\cf0\par
\cf2 database.postgres.url = \cf3 jdbc\cf2 :\cf3 postgresql://\ul localhost\ulnone :5432/\f2 test\f1 _database\cf0\par
\cf2 database.postgres.driver = \cf3\ul org\ulnone .\ul postgresql\ulnone .Driver\cf0\par
\cf2 database.postgres.user = \cf3\ul\f2 test\cf0\ulnone\f1\par
\cf2 database.postgres.pass = \f2 t\cf3\ul est\f1\par
\par
\cf0\ulnone\f0\par
\b example to oracle connection\par
\cf1\b0\f1 ## define a type of database connection\cf0\par
\cf2 database.type = \cf3\ul\f2 oracle\f1\par
\cf0\ulnone\par
\cf1 ## oracle connection\cf0\par
\cf2 database.oracle.url = \cf3 jdbc\cf2 :\cf3 oracle:thin:\ul @localhost\ulnone :1521:\ul orcl\cf0\ulnone\par
\cf2 database.oracle.driver = \cf3 oracle.\ul jdbc\ulnone .driver.OracleDriver\cf0\par
\cf2 database.oracle.user = \cf3\ul\f2 test\cf0\ulnone\f1\par
\cf2 database.oracle.pass = \cf3\ul\f2 test\cf0\ulnone\f0\par
\par
In library \b easy-gpa.jar\b0  exist a class \b Entity\b0 , in your project get the class with sugetive name for \b\par
\b0 example\par
If the table in your database named \b tb_usuario\b0  create a class with name \b Usuario and get in up of class name this annotation \cf4\b0\f1 @GPAEntity\cf2 (name=\cf3 "tb_usuario"\cf2 )\cf0\par
\f0 , and next step extends the \b Entity \b0 class and to columns of table for example, if your name are \cf4\f1 @GPAPrimaryKey\cf2 (name=\cf3 "id"\cf2 , ignore=\cf5\b true\cf2\b0 )\f2  reference by atribute id into database and get "id" field in your classe \cf0\f0 with your \cf6 getters \cf0 and \cf6 setters\cf0 , for example, if isn't primary key get the annotation \cf4\f1 @GPAField\cf2 (name=\cf3 "nome_completo"\cf2 )\cf0\par
\f0 to create a simple attribute database column\par
\par
\par
Can you make the statement create in your database configured, for example.\par
\b CREATE TABLE tb_usuario\par
(\par
  id serial NOT NULL,\par
  nome_completo character varying(10485760) NOT NULL,\par
  nome_usuario character varying(10485760) NOT NULL,\par
  senha character varying(10485760) NOT NULL\par
)\par
\par
\b0 After this you can to make a class with the table caracteristcs, and generate a bean with Entity how super class and use your methods, for example the class \b Usuario\b0 .\par
\par
\cf5\b\f1 package\cf2\b0  br.com.slv.database.dao.entity;\cf0\par
\par
\cf5\b import\cf2\b0  br.com.slv.database.dao.entity.annotation.GPAEntity;\cf0\par
\cf5\b import\cf2\b0  br.com.slv.database.dao.entity.annotation.GPAField;\cf0\par
\cf5\b import\cf2\b0  br.com.slv.database.dao.entity.annotation.GPAPrimaryKey;\cf0\par
\par
\cf4 @GPAEntity\cf2 (name=\cf3 "tb_usuario"\cf2 )\cf0\par
\cf5\b public\cf2\b0  \cf5\b class\cf2\b0  Usuario \cf5\b extends\cf2\b0  Entity\{\cf0\par
\cf2\tab\cf4 @GPAPrimaryKey\cf2 (name=\cf3 "id"\cf2 , ignore=\cf5\b true\cf2\b0 )\cf0\par
\cf2\tab\cf5\b private\cf2\b0  \cf5\b int\cf2\b0  \cf7 id\cf2 ;\cf0\par
\cf2\tab\cf4 @GPAField\cf2 (name=\cf3 "nome_completo"\cf2 )\cf0\par
\cf2\tab\cf5\b private\cf2\b0  String \cf7 nomeCompleto\cf2 ;\cf0\par
\cf2\tab\cf4 @GPAField\cf2 (name=\cf3 "nome_usuario"\cf2 )\cf0\par
\cf2\tab\cf5\b private\cf2\b0  String \cf7 nomeUsuario\cf2 ;\cf0\par
\cf2\tab\cf4 @GPAField\cf2 (name=\cf3 "senha"\cf2 )\cf0\par
\cf2\tab\cf5\b private\cf2\b0  String \cf7 senha\cf2 ;\cf0\par
\cf2\tab\cf8 /**\cf0\par
\cf2\tab  \cf8 *\cf2  \cf8 Used\cf2  \cf8 by\cf2  \cf8 insert\cf2  \cf8 without\cf2  \cf8 id,\cf2  \cf8 database\cf2  \cf8 are\cf2  \cf8 responsible\cf2  \cf0\par
\cf2\tab  \cf8 *\cf2  \cf8 to\cf2  \cf8 generate\cf2  \cf8 a\cf2  \cf8 sequential\cf2  \cf8 id\cf2  \cf8 to\cf2  \cf8 primary\cf2  \cf8 key\cf2  \cf0\par
\cf2\tab  \cf8 *\cf2  \cf9\b @param\cf2\b0  \cf8 nomeCompleto\cf0\par
\cf2\tab  \cf8 *\cf2  \cf9\b @param\cf2\b0  \cf8 nomeUsuario\cf0\par
\cf2\tab  \cf8 *\cf2  \cf9\b @param\cf2\b0  \cf8 senhaCharacter\cf0\par
\cf2\tab  \cf8 */\cf0\par
\cf2\tab\cf5\b public\cf2\b0  Usuario(String nomeCompleto, String nomeUsuario,\cf0\par
\cf2\tab\tab\tab String senhaCharacter) \{\cf0\par
\cf2\tab\tab\cf5\b super\cf2\b0 ();\cf0\par
\cf2\tab\tab\cf5\b this\cf2\b0 .\cf7 nomeCompleto\cf2  = nomeCompleto;\cf0\par
\cf2\tab\tab\cf5\b this\cf2\b0 .\cf7 nomeUsuario\cf2  = nomeUsuario;\cf0\par
\cf2\tab\tab\cf5\b this\cf2\b0 .\cf7 senha\cf2  = senhaCharacter;\cf0\par
\cf2\tab\}\cf0\par
\cf2\tab\cf8 /**\cf0\par
\cf2\tab  \cf8 *\cf2  \cf8 in\cf2  \cf8 this\cf2  \cf8 case\cf2  \cf8 the\cf2  \cf8 entity\cf2  \cf8 are\cf2  \cf8 instantied\cf2  \cf8 with\cf2  \cf8 the\cf2  \cf8 primary\cf2  \cf8 key\cf2  \cf8 information\cf0\par
\cf2\tab  \cf8 *\cf2  \cf9\b @param\cf2\b0  \cf8 id\cf0\par
\cf2\tab  \cf8 *\cf2  \cf9\b @param\cf2\b0  \cf8 nomeCompleto\cf0\par
\cf2\tab  \cf8 *\cf2  \cf9\b @param\cf2\b0  \cf8 nomeUsuario\cf0\par
\cf2\tab  \cf8 *\cf2  \cf9\b @param\cf2\b0  \cf8 senhaCharacter\cf0\par
\cf2\tab  \cf8 */\cf0\par
\cf2\tab\cf5\b public\cf2\b0  Usuario(\cf5\b int\cf2\b0  id, String nomeCompleto, String nomeUsuario,\cf0\par
\cf2\tab\tab\tab String senhaCharacter) \{\cf0\par
\cf2\tab\tab\cf5\b super\cf2\b0 ();\cf0\par
\cf2\tab\tab\cf5\b this\cf2\b0 .\cf7 id\cf2  = id;\cf0\par
\cf2\tab\tab\cf5\b this\cf2\b0 .\cf7 nomeCompleto\cf2  = nomeCompleto;\cf0\par
\cf2\tab\tab\cf5\b this\cf2\b0 .\cf7 nomeUsuario\cf2  = nomeUsuario;\cf0\par
\cf2\tab\tab\cf5\b this\cf2\b0 .\cf7 senha\cf2  = senhaCharacter;\cf0\par
\cf2\tab\}\cf0\par
\cf2\tab\cf5\b public\cf2\b0  \cf5\b int\cf2\b0  getId() \{\cf0\par
\cf2\tab\tab\cf5\b return\cf2\b0  \cf7 id\cf2 ;\cf0\par
\cf2\tab\}\cf0\par
\cf2\tab\cf5\b public\cf2\b0  \cf5\b void\cf2\b0  setId(\cf5\b int\cf2\b0  id) \{\cf0\par
\cf2\tab\tab\cf5\b this\cf2\b0 .\cf7 id\cf2  = id;\cf0\par
\cf2\tab\}\cf0\par
\cf2\tab\cf5\b public\cf2\b0  String getNomeCompleto() \{\cf0\par
\cf2\tab\tab\cf5\b return\cf2\b0  \cf7 nomeCompleto\cf2 ;\cf0\par
\cf2\tab\}\cf0\par
\cf2\tab\cf5\b public\cf2\b0  \cf5\b void\cf2\b0  setNomeCompleto(String nomeCompleto) \{\cf0\par
\cf2\tab\tab\cf5\b this\cf2\b0 .\cf7 nomeCompleto\cf2  = nomeCompleto;\cf0\par
\cf2\tab\}\cf0\par
\cf2\tab\cf5\b public\cf2\b0  String getNomeUsuario() \{\cf0\par
\cf2\tab\tab\cf5\b return\cf2\b0  \cf7 nomeUsuario\cf2 ;\cf0\par
\cf2\tab\}\cf0\par
\cf2\tab\cf5\b public\cf2\b0  \cf5\b void\cf2\b0  setNomeUsuario(String nomeUsuario) \{\cf0\par
\cf2\tab\tab\cf5\b this\cf2\b0 .\cf7 nomeUsuario\cf2  = nomeUsuario;\cf0\par
\cf2\tab\}\cf0\par
\cf2\tab\cf5\b public\cf2\b0  String getSenha() \{\cf0\par
\cf2\tab\tab\cf5\b return\cf2\b0  \cf7 senha\cf2 ;\cf0\par
\cf2\tab\}\cf0\par
\cf2\tab\cf5\b public\cf2\b0  \cf5\b void\cf2\b0  setSenha(String senha) \{\cf0\par
\cf2\tab\tab\cf5\b this\cf2\b0 .\cf7 senha\cf2  = senha;\cf0\par
\cf2\tab\}\cf0\par
\cf2\}\cf0\par
\par
\f0\par
With this entity created you can to work with this test source\par
\par
\cf2\f1\tab\cf4 @Test\cf0\par
\cf2\tab\cf5\b public\cf2\b0  \cf5\b void\cf2\b0  insert()\{\cf0\par
\cf2\tab\tab Entity e = \cf5\b new\cf2\b0  Usuario(\cf3 "test"\cf2 ,\cf3 "test"\cf2 ,\cf3 "test"\cf2 );\cf0\par
\cf2\tab\tab String result = e.insert();\cf0\par
\cf2\tab\tab\i assertNotNull\i0 (result);\cf0\par
\cf2\tab\tab\i assertEquals\i0 (\cf3 "success"\cf2 , result);\cf0\par
\cf2\tab\}\cf0\par
\cf2\tab\cf4 @Test\cf0\par
\cf2\tab\cf5\b public\cf2\b0  \cf5\b void\cf2\b0  update()\{\cf0\par
\cf2\tab\tab Entity e = \cf5\b new\cf2\b0  Usuario(6, \cf3 "test"\cf2 , \cf3 "test"\cf2 , \cf3 "test"\cf2 );\cf0\par
\cf2\tab\tab String result = e.update();\cf0\par
\cf2\tab\tab\i assertNotNull\i0 (result);\cf0\par
\cf2\tab\tab\i assertEquals\i0 (\cf3 "success"\cf2 , result);\cf0\par
\cf2\tab\}\cf0\par
\cf2\tab\cf4 @Test\cf0\par
\cf2\tab\cf5\b public\cf2\b0  \cf5\b void\cf2\b0  delete()\{\cf0\par
\cf2\tab\tab Entity e = \cf5\b new\cf2\b0  Usuario(3, \cf3 "test"\cf2 , \cf3 "test"\cf2 , \cf3 "test"\cf2 );\cf0\par
\cf2\tab\tab String result = e.delete();\cf0\par
\cf2\tab\tab\i assertNotNull\i0 (result);\cf0\par
\cf2\tab\tab\i assertEquals\i0 (\cf3 "success"\cf2 , result);\cf0\par
\cf2\tab\}\cf0\f0\par
.\par
Make this you will create a \b Entity \b0 to transact informations about the database configured\par
operation insert update and delete functionalities are opened to you use in your aplication, the easy form to manipulate transacs statements without hard implementation of anamical DAO and other hard implementations.\par
}
 